//
//  ConSingleGoodsDetailCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/4/13.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "ConSingleGoodsDetailCell.h"
#import <UIButton+WebCache.h>

@interface ConSingleGoodsDetailCell()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *buyNameLab;
@property (weak, nonatomic) IBOutlet UILabel *statusLab;
@property (weak, nonatomic) IBOutlet UIButton *shopImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *priceLab;


@end

@implementation ConSingleGoodsDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(SingleListModel *)model
{
    _model = model;
    self.buyNameLab.text = model.shopName;
    if (model.status == SingleTypeStatusUnpay) {
        self.statusLab.text = @"待付款";
    }else if (model.status == SingleTypeStatusAlreadyPay){
        self.statusLab.text = @"待收货";
        if (self.isSeller) {
            self.statusLab.text = @"待发货";
        }
    }else if (model.status == SingleTypeStatusAlreadySend){
        self.statusLab.text = @"待收货";
        if (self.isSeller) {
            self.statusLab.text = @"已发货";
        }
    }else if (model.status == SingleTypeStatusCompleted){
        self.statusLab.text = @"已完成";
    }else if (model.status == SingleTypeStatusAlreadyEvaluate){
        self.statusLab.text = @"已评价";
    }
    [self.shopImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:model.thumbnailUrl] forState:UIControlStateNormal placeholderImage:GetImage(@"default_goods_image")];
    self.titleLab.text = model.productName;
    if (model.status == 1) {
        self.priceLab.text = [NSString stringWithFormat:@"共%zd件商品，还需付款¥%.2f元",model.productCount,model.totalPrice];
    }else{
        self.priceLab.text = [NSString stringWithFormat:@"共%zd件商品，实付金额¥%.2f元",model.productCount,model.totalPrice];
    }
}

@end
